<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="layout.xhtml">
        <ui:define name="body">
            <h2>Pesquisar Sala</h2>

            <p:panel styleClass="container_24 clearfix " style="background: none; border: none;"> 
                <h:form id="form" acceptcharset="utf-8">
                    <p:growl id="msg" life="3000" autoUpdate="true"/>

                    <p class="subtitle">Filtros</p>

                    <p:outputLabel value="Numero :" styleClass="grid_3"/>
                    <p:inputText value="#{managerPesquisarSala.salaPesquisar.numero}" styleClass="grid_7"/>
                    <div class="clear"/>

                    <p:outputLabel value="Qtd Aluno :" styleClass="grid_3"/>
                    <p:inputText value="#{managerPesquisarSala.salaPesquisar.quantidadeAluno}"  styleClass="grid_20"/>

                    <div class="clear"/>
                    <div class="buttonAction">
                        <p:commandButton value="Pesquisar" icon="ui-icon-search" 
                                         actionListener="#{managerPesquisarSala.pesquisar()}" 
                                         update="@form" styleClass="ui-priority-primary"/>
                       
                         <p:button value="Cancelar" href="indexsala.xhtml" icon="ui-icon-close"/> 

                    </div>

                    <p class="subtitle">Resultado</p>

                    <p:dataTable id="cursoDataTable" value="#{managerPesquisarSala.salas}" var="item"
                                 styleClass="grid_24" emptyMessage="Nenhum registro">

                        <f:facet name="header">
                            Salas
                        </f:facet>

                        <p:column headerText="Ação" width="50">
                            <p:button title="Editar"
                                      href="editarsala.xhtml?eSala=#{item.id}"
                                      icon="ui-icon-pencil"/>
                            <p:button title="Visualizar"
                                      href="visualizarsala.xhtml?vSala=#{item.id}"
                                      icon="ui-icon-zoomin"/>
                            <p:commandButton update="@form" title="Excluir"
                                             oncomplete="dlg.show()"
                                             icon="ui-icon-trash" >
                                <f:setPropertyActionListener target="#{managerPesquisarSala.salaDelete}" value="#{item}" />
                            </p:commandButton>
                        </p:column>

                        <p:column headerText="Número" width="180">  
                            #{item.numero}
                        </p:column>

                        <p:column headerText="Qtd Aluno">  
                            #{item.quantidadeAluno}
                        </p:column> 

                    </p:dataTable>


                    <p:dialog id="modalDialog" header="Confirmação de remoção" widgetVar="dlg" modal="true" 
                              height="80" closable="true" resizable="false" >
                        <h:outputText value="Tem certeza que deseja remover este curso?" />
                        <div class="buttonAction">
                            <p:commandButton value="Sim"
                                             actionListener="#{managerPesquisarSala.deletar()}"
                                             update="@form"
                                             icon="ui-icon-check"/>
                            <p:commandButton value="Não" icon="ui-icon-close"
                                             oncomplete="dlg.hide()" />

                        </div>
                    </p:dialog>
                    
                    <div class="clear"/>
                    <div class="buttonAction">
                        <p:button value="Voltar" icon="ui-icon-circle-arrow-w"
                                  href="indexsala.xhtml"/>

                    </div>

                </h:form>
            </p:panel> 
        </ui:define>
    </ui:composition>
</html>